﻿#if USE_UNI_LUA
using LuaAPI = UniLua.Lua;
using RealStatePtr = UniLua.ILuaState;
using LuaCSFunction = UniLua.CSharpFunctionDelegate;
#else
using LuaAPI = XLua.LuaDLL.Lua;
using RealStatePtr = System.IntPtr;
using LuaCSFunction = XLua.LuaDLL.lua_CSFunction;
#endif

using XLua;
using System.Collections.Generic;


namespace XLua.CSObjectWrap
{
    using Utils = XLua.Utils;
    public class UnityEngineNetworkingPlayerConnectionPlayerConnectionWrap 
    {
        public static void __Register(RealStatePtr L)
        {
			ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
			System.Type type = typeof(UnityEngine.Networking.PlayerConnection.PlayerConnection);
			Utils.BeginObjectRegister(type, L, translator, 0, 11, 1, 0);
			
			Utils.RegisterFunc(L, Utils.METHOD_IDX, "OnEnable", _m_OnEnable);
			Utils.RegisterFunc(L, Utils.METHOD_IDX, "Register", _m_Register);
			Utils.RegisterFunc(L, Utils.METHOD_IDX, "Unregister", _m_Unregister);
			Utils.RegisterFunc(L, Utils.METHOD_IDX, "RegisterConnection", _m_RegisterConnection);
			Utils.RegisterFunc(L, Utils.METHOD_IDX, "RegisterDisconnection", _m_RegisterDisconnection);
			Utils.RegisterFunc(L, Utils.METHOD_IDX, "UnregisterConnection", _m_UnregisterConnection);
			Utils.RegisterFunc(L, Utils.METHOD_IDX, "UnregisterDisconnection", _m_UnregisterDisconnection);
			Utils.RegisterFunc(L, Utils.METHOD_IDX, "Send", _m_Send);
			Utils.RegisterFunc(L, Utils.METHOD_IDX, "TrySend", _m_TrySend);
			Utils.RegisterFunc(L, Utils.METHOD_IDX, "BlockUntilRecvMsg", _m_BlockUntilRecvMsg);
			Utils.RegisterFunc(L, Utils.METHOD_IDX, "DisconnectAll", _m_DisconnectAll);
			
			
			Utils.RegisterFunc(L, Utils.GETTER_IDX, "isConnected", _g_get_isConnected);
            
			
			
			Utils.EndObjectRegister(type, L, translator, null, null,
			    null, null, null);

		    Utils.BeginClassRegister(type, L, __CreateInstance, 1, 1, 0);
			
			
            
			Utils.RegisterFunc(L, Utils.CLS_GETTER_IDX, "instance", _g_get_instance);
            
			
			
			Utils.EndClassRegister(type, L, translator);
        }
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int __CreateInstance(RealStatePtr L)
        {
            
			try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
				if(LuaAPI.lua_gettop(L) == 1)
				{
					
					var gen_ret = new UnityEngine.Networking.PlayerConnection.PlayerConnection();
					translator.Push(L, gen_ret);
                    
					return 1;
				}
				
			}
			catch(System.Exception gen_e) {
				return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
			}
            return LuaAPI.luaL_error(L, "invalid arguments to UnityEngine.Networking.PlayerConnection.PlayerConnection constructor!");
            
        }
        
		
        
		
        
        
        
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _m_OnEnable(RealStatePtr L)
        {
		    try {
            
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
            
            
                UnityEngine.Networking.PlayerConnection.PlayerConnection gen_to_be_invoked = (UnityEngine.Networking.PlayerConnection.PlayerConnection)translator.FastGetCSObj(L, 1);
            
            
                
                {
                    
                    gen_to_be_invoked.OnEnable(  );
                    
                    
                    
                    return 0;
                }
                
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
            }
            
        }
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _m_Register(RealStatePtr L)
        {
		    try {
            
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
            
            
                UnityEngine.Networking.PlayerConnection.PlayerConnection gen_to_be_invoked = (UnityEngine.Networking.PlayerConnection.PlayerConnection)translator.FastGetCSObj(L, 1);
            
            
                
                {
                    System.Guid _messageId;translator.Get(L, 2, out _messageId);
                    UnityEngine.Events.UnityAction<UnityEngine.Networking.PlayerConnection.MessageEventArgs> _callback = translator.GetDelegate<UnityEngine.Events.UnityAction<UnityEngine.Networking.PlayerConnection.MessageEventArgs>>(L, 3);
                    
                    gen_to_be_invoked.Register( _messageId, _callback );
                    
                    
                    
                    return 0;
                }
                
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
            }
            
        }
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _m_Unregister(RealStatePtr L)
        {
		    try {
            
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
            
            
                UnityEngine.Networking.PlayerConnection.PlayerConnection gen_to_be_invoked = (UnityEngine.Networking.PlayerConnection.PlayerConnection)translator.FastGetCSObj(L, 1);
            
            
                
                {
                    System.Guid _messageId;translator.Get(L, 2, out _messageId);
                    UnityEngine.Events.UnityAction<UnityEngine.Networking.PlayerConnection.MessageEventArgs> _callback = translator.GetDelegate<UnityEngine.Events.UnityAction<UnityEngine.Networking.PlayerConnection.MessageEventArgs>>(L, 3);
                    
                    gen_to_be_invoked.Unregister( _messageId, _callback );
                    
                    
                    
                    return 0;
                }
                
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
            }
            
        }
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _m_RegisterConnection(RealStatePtr L)
        {
		    try {
            
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
            
            
                UnityEngine.Networking.PlayerConnection.PlayerConnection gen_to_be_invoked = (UnityEngine.Networking.PlayerConnection.PlayerConnection)translator.FastGetCSObj(L, 1);
            
            
                
                {
                    UnityEngine.Events.UnityAction<int> _callback = translator.GetDelegate<UnityEngine.Events.UnityAction<int>>(L, 2);
                    
                    gen_to_be_invoked.RegisterConnection( _callback );
                    
                    
                    
                    return 0;
                }
                
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
            }
            
        }
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _m_RegisterDisconnection(RealStatePtr L)
        {
		    try {
            
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
            
            
                UnityEngine.Networking.PlayerConnection.PlayerConnection gen_to_be_invoked = (UnityEngine.Networking.PlayerConnection.PlayerConnection)translator.FastGetCSObj(L, 1);
            
            
                
                {
                    UnityEngine.Events.UnityAction<int> _callback = translator.GetDelegate<UnityEngine.Events.UnityAction<int>>(L, 2);
                    
                    gen_to_be_invoked.RegisterDisconnection( _callback );
                    
                    
                    
                    return 0;
                }
                
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
            }
            
        }
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _m_UnregisterConnection(RealStatePtr L)
        {
		    try {
            
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
            
            
                UnityEngine.Networking.PlayerConnection.PlayerConnection gen_to_be_invoked = (UnityEngine.Networking.PlayerConnection.PlayerConnection)translator.FastGetCSObj(L, 1);
            
            
                
                {
                    UnityEngine.Events.UnityAction<int> _callback = translator.GetDelegate<UnityEngine.Events.UnityAction<int>>(L, 2);
                    
                    gen_to_be_invoked.UnregisterConnection( _callback );
                    
                    
                    
                    return 0;
                }
                
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
            }
            
        }
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _m_UnregisterDisconnection(RealStatePtr L)
        {
		    try {
            
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
            
            
                UnityEngine.Networking.PlayerConnection.PlayerConnection gen_to_be_invoked = (UnityEngine.Networking.PlayerConnection.PlayerConnection)translator.FastGetCSObj(L, 1);
            
            
                
                {
                    UnityEngine.Events.UnityAction<int> _callback = translator.GetDelegate<UnityEngine.Events.UnityAction<int>>(L, 2);
                    
                    gen_to_be_invoked.UnregisterDisconnection( _callback );
                    
                    
                    
                    return 0;
                }
                
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
            }
            
        }
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _m_Send(RealStatePtr L)
        {
		    try {
            
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
            
            
                UnityEngine.Networking.PlayerConnection.PlayerConnection gen_to_be_invoked = (UnityEngine.Networking.PlayerConnection.PlayerConnection)translator.FastGetCSObj(L, 1);
            
            
                
                {
                    System.Guid _messageId;translator.Get(L, 2, out _messageId);
                    byte[] _data = LuaAPI.lua_tobytes(L, 3);
                    
                    gen_to_be_invoked.Send( _messageId, _data );
                    
                    
                    
                    return 0;
                }
                
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
            }
            
        }
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _m_TrySend(RealStatePtr L)
        {
		    try {
            
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
            
            
                UnityEngine.Networking.PlayerConnection.PlayerConnection gen_to_be_invoked = (UnityEngine.Networking.PlayerConnection.PlayerConnection)translator.FastGetCSObj(L, 1);
            
            
                
                {
                    System.Guid _messageId;translator.Get(L, 2, out _messageId);
                    byte[] _data = LuaAPI.lua_tobytes(L, 3);
                    
                        var gen_ret = gen_to_be_invoked.TrySend( _messageId, _data );
                        LuaAPI.lua_pushboolean(L, gen_ret);
                    
                    
                    
                    return 1;
                }
                
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
            }
            
        }
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _m_BlockUntilRecvMsg(RealStatePtr L)
        {
		    try {
            
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
            
            
                UnityEngine.Networking.PlayerConnection.PlayerConnection gen_to_be_invoked = (UnityEngine.Networking.PlayerConnection.PlayerConnection)translator.FastGetCSObj(L, 1);
            
            
                
                {
                    System.Guid _messageId;translator.Get(L, 2, out _messageId);
                    int _timeout = LuaAPI.xlua_tointeger(L, 3);
                    
                        var gen_ret = gen_to_be_invoked.BlockUntilRecvMsg( _messageId, _timeout );
                        LuaAPI.lua_pushboolean(L, gen_ret);
                    
                    
                    
                    return 1;
                }
                
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
            }
            
        }
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _m_DisconnectAll(RealStatePtr L)
        {
		    try {
            
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
            
            
                UnityEngine.Networking.PlayerConnection.PlayerConnection gen_to_be_invoked = (UnityEngine.Networking.PlayerConnection.PlayerConnection)translator.FastGetCSObj(L, 1);
            
            
                
                {
                    
                    gen_to_be_invoked.DisconnectAll(  );
                    
                    
                    
                    return 0;
                }
                
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
            }
            
        }
        
        
        
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _g_get_instance(RealStatePtr L)
        {
		    try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
			    translator.Push(L, UnityEngine.Networking.PlayerConnection.PlayerConnection.instance);
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
            }
            return 1;
        }
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _g_get_isConnected(RealStatePtr L)
        {
		    try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
			
                UnityEngine.Networking.PlayerConnection.PlayerConnection gen_to_be_invoked = (UnityEngine.Networking.PlayerConnection.PlayerConnection)translator.FastGetCSObj(L, 1);
                LuaAPI.lua_pushboolean(L, gen_to_be_invoked.isConnected);
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
            }
            return 1;
        }
        
        
        
		
		
		
		
    }
}
